import React from "react";
import { Navigate } from "react-router-dom";

// 懒加载
const Discover = React.lazy(() => import("@/pages/discover"));
const Recommend = React.lazy(() =>
  import("@/pages/discover/c-pages/recommend")
);
const Ranking = React.lazy(() => import("@/pages/discover/c-pages/ranking"));
const Songs = React.lazy(() => import("@/pages/discover/c-pages/songs"));
const Djradio = React.lazy(() => import("@/pages/discover/c-pages/djradio"));
const Artist = React.lazy(() => import("@/pages/discover/c-pages/artist"));
const Album = React.lazy(() => import("@/pages/discover/c-pages/album"));

const Mine = React.lazy(() => import("@/pages/mine"));
const Friend = React.lazy(() => import("@/pages/friend"));
const NotFound = React.lazy(() => import("@/pages/not-found"));

const routes = [
  {
    path: "/",
    element: <Navigate to="/Discover" />,
  },
  {
    path: "*",
    element: <NotFound />,
  },
  {
    path: "discover",
    element: <Discover />,
    children: [
      { index: true, element: <Navigate to="/discover/recommend" replace /> },
      {
        path: "/discover/recommend",
        element: <Recommend />,
      },
      {
        path: "/discover/ranking",
        element: <Ranking />,
      },
      {
        path: "/discover/songs",
        element: <Songs />,
      },
      {
        path: "/discover/djradio",
        element: <Djradio />,
      },
      {
        path: "/discover/artist",
        element: <Artist />,
      },
      {
        path: "/discover/album",
        element: <Album />,
      },
    ],
  },
  {
    path: "/mine",
    element: <Mine />,
  },
  {
    path: "/friend",
    element: <Friend />,
  },
];

export default routes;
